<?php
$valores = "";
$titulos = "";
$acciones = "";
$tituloGrafica = array_pop($ofertas); //extrae el titulo de la grafica
//echo $this->session->userdata("sqlPruebaRodrigo");
arsort($ofertas,SORT_NUMERIC); //ordeno la matriz de forma inversa
foreach ($ofertas as $key => $value){
    $valores .= "$value,";
    $titulos .= "\"%%.%%($value) - ".$key."\",";
    if($value == 0 )continue;
    $acciones .= "\"javascript:fnAbreDetalle('$key');\",";
}
$valores = trim($valores, ",");
$titulos = trim($titulos, ",");
$acciones = trim($acciones, ",");
?>
<script type="text/javascript" charset="utf-8">
                var r = Raphael("holder");
                r.g.txtattr.font = "12px 'Fontin Sans', Fontin-Sans, sans-serif";
                r.g.text(220, 50, "Para mayor detalle, click sobre parte de la grafica").attr({"font-size": 16,"fill":"#6837FC"});
                r.g.text(320, 100, "<?php echo "TOTAL OFERTAS LABORALES: ".$tituloGrafica; ?>").attr({"font-size": 20});

                var pie = r.g.piechart(130, 240, 100, [<?php echo $valores;?>], {legend: [<?php echo $titulos;?>], legendpos: "east", href: [<?php echo $acciones;?>]});
                pie.hover(function () {
                    this.sector.stop();
                    this.sector.scale(1.1, 1.1, this.cx , this.cy);
                    if (this.label) {
                        this.label[0].stop();
                        this.label[0].scale(1.5);
                        this.label[1].attr({"font-weight": 800});
                    }
                }, function () {
                    this.sector.animate({scale: [1, 1, this.cx, this.cy]}, 500, "bounce");
                    if (this.label) {
                        this.label[0].animate({scale: 1}, 500, "bounce");
                        this.label[1].attr({"font-weight": 400});
                    }
                });
        </script>
